package com.mc.micronmall.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.mc.micronmall.domain.UserMember;
import com.mc.micronmall.service.UserMemberService;
import com.mc.micronmall.util.Result;
import jakarta.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/users")
public class UserMemberController {

    @Resource
    private UserMemberService userMemberService;



    @RequestMapping("/getUserInfo")
    private Result<UserMember> getUserMemberInfoByUserAndPassWord(){
        QueryWrapper<UserMember> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("username","sunflower");
        queryWrapper.eq("password","111111");
        UserMember member = userMemberService.getOne(queryWrapper);
        System.out.println(member);

        if (member != null) {
            return Result.success(member);
        } else {
            return Result.fail(); // 或者你可以返回一个包含特定错误信息的Result对象
        }
    }
}
